package 快速排序;

import java.util.Scanner;

public class Main {
    static int N = 100010, n;
    static int[] q = new int[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        for (int i = 0; i < n; i++) {
            q[i] = in.nextInt();
        }
        qsort(0, n - 1);
        for (int i = 0; i < n; i++) {
            System.out.print(q[i] + " ");
        }
    }

    private static void qsort(int l, int r) {
        if (l >= r) {
            return;
        }
        int i = l - 1, j = r + 1, x = q[l + r >> 1];//x=q[(l+r+1)>>1]
        while (i < j) {
            do {
                i++;
            } while (q[i] < x);
            do {
                j--;
            } while (q[j] > x);
            if (i < j) {
                swap(i, j);
            }
        }
        qsort(l, j);//(l,i-1)
        qsort(j + 1, r);//(i,r)
    }

    private static void swap(int i, int j) {
        int t = q[i];
        q[i] = q[j];
        q[j] = t;
    }
}
